package com.cloud.user_info.service.impl;

import com.cloud.user_info.service.ISysMenuService;
import com.cloud.user_info.service.ISysRoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Set;

/**
 * 用户权限处理
 *
 * @author yzj
 */
@Component
public class SysPermissionService {

    @Autowired
    private ISysRoleService roleService;

    @Autowired
    private ISysMenuService menuService;

    /**
     * 获取角色数据权限
     *
     * @param userId 用户ID
     * @return 角色权限信息
     */
    public Set<String> getRolePermission(String sysCode, Long userId) {
        return roleService.selectRolePermsById(sysCode, userId);
    }

    /**
     * 获取菜单数据权限
     *
     * @param userId 用户ID
     * @return 菜单权限信息
     */
    public Set<String> getMenuPermission(String sysCode, Long userId) {
        return menuService.selectMenuPermsById(sysCode, userId);
    }
}
